package tdh.dao.Impl;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;
import tdh.dao.BzdmDao;
import tdh.entity.po.Bzdm;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author 曹昊
 * @date 2021/7/15
 */
@Repository("bzdmDao")
public class BzdmDaoImpl implements BzdmDao {
    @Autowired
    SessionFactory sessionFactory;
    @Autowired
    HibernateTemplate hibernateTemplate;

    @Override
    public List<Bzdm> bzdms() {
        ArrayList<Bzdm> bzdms = new ArrayList<Bzdm>();
        List list = hibernateTemplate.find("From tdh.entity.po.Bzdm");
        for (Iterator iterator = list.iterator(); iterator.hasNext();){
            Bzdm bzdm = (Bzdm) iterator.next();
            bzdms.add(bzdm);
        }
        return bzdms;
    }
}
